import type { Reducer, Effect } from 'umi';

import type { NoticeIconData } from '@/components/NoticeIcon';
import { queryNotices } from '@/services/user';
import type { ConnectState } from './connect.d';

export type NoticeItem = {
  id: string;
  type: string;
  status: string;
} & NoticeIconData;

export type GlobalModelState = {
  collapsed: boolean;
};

export type GlobalModelType = {
  namespace: 'global';
  state: GlobalModelState;

  reducers: {
    changeLayoutCollapsed: Reducer<GlobalModelState>;
  };
};

const GlobalModel: GlobalModelType = {
  namespace: 'global',

  state: {
    collapsed: false,
  },

  reducers: {
    changeLayoutCollapsed(state = {  collapsed: true }, { payload }): GlobalModelState {

      console.log("==========changeLayoutCollapsed =================");

      return {
        ...state,
        collapsed: payload,
      };
    },
  },
};

export default GlobalModel;
